package com.bra.view;

import java.util.Map;

import com.bra.ui.adapter.VenueDetails_Recommend_adapter;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.Toast;
import android.widget.LinearLayout.LayoutParams;
/**
 * 场馆详情页面推荐view
 * @author lenovo
 *
 */
public class Hsv_Recommend extends LinearLayout {

	private VenueDetails_Recommend_adapter adapter;
	private Context context;
	public Hsv_Recommend(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context=context;
	}
	
	public void setAdapter(VenueDetails_Recommend_adapter adapter) {
		this.adapter = adapter;
		for(int i=0;i<adapter.getCount();i++){
			//final Map<String,Object> map=adapter.getItem(i);
			final Object  map=adapter.getItem(i);
			View view=adapter.getView(i, null, null);
			view.setPadding(10, 0, 10, 0);
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					Toast.makeText(context, "您点击了"+map, Toast.LENGTH_SHORT).show();
				}
			});
			this.setOrientation(HORIZONTAL);
			this.addView(view,new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
		}
	}
}
